
/**
 * 
 * @param server_data   
 * @param imageId
 * @param inputImageId
 */
function methodIs(server_data,imageId,inputImageId){
		var server_data_json = eval('(' + server_data + ')'); 
		var imageObj= document.getElementById(imageId);
		imageObj.setAttribute("src",server_data_json.data.url); 
		var inputImageIdObj = document.getElementById(inputImageId);
		inputImageIdObj.setAttribute("value",server_data_json.data.url); 
}

function MySwfUpLoad(upId,btnCancel,imageId,inputImageId){
	MySwfUpLoad(upId,btnCancel,imageId,inputImageId,false);
}

/**
 * 文件上传
 * @param upId  上传按钮的Id
 * @param btnCancel 取消按钮Id（去掉会报错误）
 * @param imageId   图片的 <img> id
 * @param inputImageId 图片 <input> id
 */
function MySwfUpLoad(upId,btnCancel,imageId,inputImageId,compre) { 
			var isCompre =1;
			var isCutImage =1;
			if(compre){
				isCompre=2;
				isCutImage=2;
			}
			var swfu;
			var settings = {
				flash_url : "js/swfupload/swfupload.swf",
				upload_url: "http://img.zuwo.la/YmUpload_image",
				post_params: {
					isCompre:isCompre,
					isCutImage:isCutImage
				},
				file_size_limit : "3 MB",
				file_types : "*.jpg;*.gif;*.png",
				file_types_description : "Web Image Files",
				file_upload_limit : 100,
				file_queue_limit : 0,
				custom_settings : { 
					cancelButtonId : btnCancel
				},
				debug: false,
				
				// Button settings
				button_image_url: "../images/manager/myUpLoad.png",
				button_width: "26",
				button_height: "26",
				button_placeholder_id: upId,
				button_text: '',
				button_text_style: ".theFont { font-size: 16; }",
				button_text_left_padding: 12,
				button_text_top_padding: 3,
				button_action : SWFUpload.BUTTON_ACTION.SELECT_FILE,
				
				// The event handler functions are defined in handlers.js
				file_queued_handler : fileQueued,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_start_handler : uploadStart,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : function(fileObj,server_data){  
					methodIs(server_data,imageId,inputImageId)
				},
				upload_complete_handler : uploadComplete,
				queue_complete_handler : queueComplete	// Queue plugin event
			};

			swfu = new SWFUpload(settings); 
}